<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
  <script src="./apidemo.js"></script>
</head>
<body>
  <button onclick="test()">点击我</button>
  <button onclick="axiosDemo()">axios</button>
  <div id="content"></div>
  <script>
    function test () {
      ajax('FindStoryBycity', null, { city: '成都' }, [], { contentType: 'application/json', Cookie: '{ name: "张三" }' }).then((res) => {
        console.log(res)
      }).catch(error => {
        console.log(error)
      })
    }
    function axiosDemo(){
      axios({
        url: 'http://api.yaju.chenliang0829.cn/story/findByCity?city=成都',
        method: 'get',
        responseType:'json',
        timeout: 1000
      }).then(res => {
        console.log(res)
      }).catch(error => {
        console.log(error)
      })
    }
  </script>
</body>
</html>